<?php

namespace App\Observers;

use App\Models\Vendor;

class VendorObserver
{
	public function created(Vendor $vendor)
	{
		$vendor->createAdminAccount();
	}
	
	public function deleting(Vendor $vendor)
	{
		if (has_child($vendor, 'products')) {
			abort(403, '检测到关联商品');
		}
	}
}
